package sweetcamera;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Toast;

import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.utils.StringUtils;

public class CameraPublishTextActivity extends Activity implements View.OnClickListener {
    private EditText cpt_edit;
    private InputMethodManager imm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_camerapublish_text);
        imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        initView();
    }


    void initView() {
        findViewById(R.id.iv_back).setOnClickListener(this);
        findViewById(R.id.titlt_sure).setOnClickListener(this);
        cpt_edit = (EditText) findViewById(R.id.cpt_edit);
        if (!StringUtils.isEmpty(CameraPublishActivity.content)) {
            cpt_edit.setText(CameraPublishActivity.content);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.titlt_sure:
                String cc = cpt_edit.getText().toString();
//                if (StringUtils.isEmpty(cc)) {
//                    Toast.makeText(this, "输入内容不能为空", Toast.LENGTH_SHORT).show();
//                    return;
//                }
                CameraPublishActivity.content = cc;
                sendBroadcast(new Intent("updateContent"));
                finish();
                break;
        }
    }
}
